package service.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import pojo.Member;
import service.MemberManager;
import vo.ValueObject;
import vo.impl.InputValueObject;
import basic.dao.HiberDao;

public class MemberManagerImpl implements MemberManager {
	private static final Log LOGGER = LogFactory.getLog(MemberManagerImpl.class);

	private HiberDao hiberDao;

	public void setHiberDao(HiberDao hiberDao) {
		this.hiberDao = hiberDao;
	}

	public List<?> info(ValueObject vo) {
		List<?> list = this.hiberDao.find("from Member");
		return list;
	}

	public Boolean login(ValueObject vo) {
		InputValueObject ivo = (InputValueObject) vo;
		Map<String, String> params = ivo.getParams();
		Member member = new Member();
		member.setName(params.get("name"));
		member.setPassword(params.get("password"));
		this.hiberDao.save(member);
		return new Boolean(true);
	}
}
